import { defHttp } from '/@/utils/http/axios';

enum Api {
  // 获取时间脉络数据
  getTimelineData = '/patent/patent/timeline/v2',
  // 生成时间脉络数据
  generateTimelineData = '/patent/patent/timeline/generate',
  // 获取年份分布统计
  getYearDistribution = '/patent/patent/timeline/year-distribution',
  // 获取机构统计
  getInstitutionStats = '/patent/patent/timeline/institution-stats',
  // 获取发明人统计
  getInventorStats = '/patent/patent/timeline/inventor-stats',
  // 测试数据库连接
  testConnection = '/patent/patent/test',
}

/**
 * 获取专利时间脉络数据
 * @param params 查询参数
 */
export const getTimelineData = (params?: any) =>
  defHttp.get<any>({ url: Api.getTimelineData, params });

/**
 * 生成时间脉络数据
 */
export const generateTimelineData = () =>
  defHttp.post<any>({ url: Api.generateTimelineData });

/**
 * 获取年份分布统计
 * @param params 查询参数
 */
export const getYearDistribution = (params?: any) =>
  defHttp.get<any>({ url: Api.getYearDistribution, params });

/**
 * 获取机构统计
 * @param params 查询参数
 */
export const getInstitutionStats = (params?: any) =>
  defHttp.get<any>({ url: Api.getInstitutionStats, params });

/**
 * 获取发明人统计
 * @param params 查询参数
 */
export const getInventorStats = (params?: any) =>
  defHttp.get<any>({ url: Api.getInventorStats, params });

/**
 * 测试数据库连接
 */
export const testConnection = () =>
  defHttp.get<any>({ url: Api.testConnection });